package com.example.shop_2302.room

import androidx.room.Dao
import androidx.room.Delete
import androidx.room.Insert
import androidx.room.OnConflictStrategy.REPLACE
import androidx.room.Query

/**
 * 对历史搜索记录进行增、删、查等操作
 */
@Dao
interface RecordDao {
    @Insert(onConflict = REPLACE)
    fun insert(record: Record)

    //删除
    @Delete
    fun delete(record: Record)
    //删除所有
    @Query("delete from record where phone = :phone")
    fun deleteAll(phone:String)

    //查询
    @Query("select * from record where phone = :phone")
    fun query(phone:String):MutableList<Record>
}